import 'package:flutter/material.dart';
import 'package:ls_work/a_training/model/train_entity.dart';
import 'package:ls_work/a_training/page/training_detail_page.dart';
import 'package:ls_work/net/net.dart';
import 'package:ls_work/res/styles.dart';
import 'package:ls_work/util/app_navigator.dart';
import 'package:ls_work/widgets/load_image.dart';

class TrainingCell extends StatelessWidget {
  final TrainInfo? info;
  TrainingCell({Key? key, this.info});

  @override
  Widget build(BuildContext context) {
    return ListTile(
      leading: LoadImage(
        '${HttpApi.imageDownLoadUrl}${info?.attachId}',
        width: 60,
        height: 60,
      ),
      title: Padding(
        padding: EdgeInsets.only(bottom: 5),
        child: Text(
          '${info?.name ?? ''}',
          style: TextStyles.textBoldDark16,
        ),
      ),
      subtitle: Text(
        '${info?.profile ?? ''}',
        maxLines: 2,
        style: TextStyles.textGray14,
        overflow: TextOverflow.ellipsis,
      ),
      onTap: () {
        AppNavigator.push(
          context,
          TrainingDetailPage(
            info: info,
          ),
        );
      },
    );
  }
}
